const express = require('express')
const router = express.Router()
//文章缓存中间件
const redisCacheArticlesMiddleWare = require('../../../../middleWare/cacheArticle.js')
//文章查询中间件
const getArticlesMiddleWare = require('../../../../middleWare/getArticles.js')
//获取所有文章路由
const getArticlesControl = require('../../controller/article/getArticles.js')
router.get('/api/article',redisCacheArticlesMiddleWare,getArticlesMiddleWare, getArticlesControl) 
//获取文章归档路由
const getArchivesControl = require('../../controller/article/getArticleArchives.js')
router.get('/api/archives',getArchivesControl)
//根据分类查询对应的文章
const getCateGoryArticleControl = require('../../controller/article/getSomeCateGory.js')
router.get('/api/getCateGoryArticle',getCateGoryArticleControl)
//用户点赞文章路由
const userAddLikesControl = require('../../controller/article/userAddLikes.js')
router.post('/api/userAddLikes',userAddLikesControl)
//用户取消文章点赞路由
const userCanelLikesControl = require('../../controller/article/userCanelLikes.js')
router.post('/api/userCanelLikes',userCanelLikesControl)  
//用户获取文章点赞文章路由
const getUserLikedArticlesControl = require('../../controller/article/getUserLikes.js')
router.post('/api/getUserLikedArticles',getUserLikedArticlesControl)
//用户下载文章路由
const userDownloadControl = require('../../controller/article/userDownload.js')
router.post('/api/userDownload',userDownloadControl)
module.exports = router
